#include "ros/ros.h"
#include "testMsgs1/Person.h"

int main(int argc, char *argv[])
{
    setlocale(LC_ALL, "");
    ros::init(argc, argv, "talker");
    ros::NodeHandle nh;
    ros::Publisher pub = nh.advertise<testMsgs1::Person>("chatter", 10);

    ros::Rate rate(1);
    ros::Duration(3).sleep();

    testMsgs1::Person person;
    person.name = "baichen";
    person.age = 1;
    person.grade = 0;

    while(ros::ok())
    {
        pub.publish(person);
        ROS_INFO("发布了一个消息: %s,%d,%lf", person.name.c_str(), person.age, person.grade);
        person.age++;
        person.grade += 1;
        rate.sleep();
        ros::spinOnce();
    }

    return 0;
}
